// RendererTestDoc.cpp : implementation of the CRendererTestDoc class
//

#include "stdafx.h"
#include "RendererTest.h"

#include "RendererTestDoc.h"
#include <renderer/camera.h>


USING_NAMESPACE_OXGE
#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CRendererTestDoc

IMPLEMENT_DYNCREATE(CRendererTestDoc, CDocument)

BEGIN_MESSAGE_MAP(CRendererTestDoc, CDocument)
END_MESSAGE_MAP()


// CRendererTestDoc construction/destruction

CRendererTestDoc::CRendererTestDoc()
{
	// TODO: add one-time construction code here
	m_pSceneRoot = NULL;
}

CRendererTestDoc::~CRendererTestDoc()
{
	delete m_pSceneRoot;
}

BOOL CRendererTestDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)
	m_pSceneRoot = new SceneNode;
	Camera* pCamera = m_pSceneRoot->CreateCamera();
	pCamera->SetPosition(Point3(0,0,-5));
	m_pSceneRoot->SetActiveCamera(pCamera);

	SceneObject * newObject = new SceneObject;
	newObject->SetColor(ColorRGBA::Red);
	newObject->AddFace( newObject->AddPoint(Point3(0,1,1)),
						newObject->AddPoint(Point3(1,2,1)),
						newObject->AddPoint(Point3(3,2,2)) );

	m_pSceneRoot->AddSceneObject(newObject);
	

	return TRUE;
}




// CRendererTestDoc serialization

void CRendererTestDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}


// CRendererTestDoc diagnostics

#ifdef _DEBUG
void CRendererTestDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CRendererTestDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG


// CRendererTestDoc commands
